/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package dca.sistemascontrole.malhadecontrole;

/**
 *
 * @author Rafael
 */
public abstract class MalhaFechada extends MalhaDeControle {

    public static final int P = 1;
    public static final int PI = 2;
    public static final int PD = 3;
    public static final int PID = 4;
    public static final int PI_D = 5;

    public MalhaFechada(double setpoint) {
        super();
        variaveisDeControle.setSetPoint(setpoint);
    }

    public double getSetpoint() {
        return variaveisDeControle.getSetPoint();
    }

    public void setSetpoint(double setpoint) {
        variaveisDeControle.setSetPoint(setpoint);
    }

    public static MalhaFechada criarMalhaFechada(int tipo, float setpoint, float kp, float ki, float kd) {
        switch (tipo) {
            case P:
                return new ControladorP(setpoint, kp);
            case PI:
                return new ControladorPI(setpoint, kp, ki);
            case PD:
                return new ControladorPD(setpoint, kp, kd);
            case PID:
                return new ControladorPID(setpoint, kp, ki, kd);
            case PI_D:
                return new ControladorPI_D(setpoint, kp, ki, kd);
        }

        return null;
    }
}
